package com.legendshop.openportal.sdk.model.request;

import com.legendshop.openportal.sdk.annotation.JsonValid;
import com.legendshop.openportal.sdk.model.BaseRequest;
import com.legendshop.openportal.sdk.model.constants.ApiPathConstants;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @Description: 校验商品可售性
 * @Author lwj
 * @data 2024/7/1
 **/
@Data
@Accessors(chain = true)
public class CheckSkuSaleStateAndStockRequest  extends BaseRequest {

    private static final long serialVersionUID = -6288726425210226251L;



    @NotNull(message = "省地区ID不能为空")
    @ApiModelProperty(value = "省地区ID")
    private Long province;

    @NotNull(message = "城市地区ID不能为空")
    @ApiModelProperty(value = "城市地区ID")
    private Long city;

    @NotNull(message = "区县地区ID不能为空")
    @ApiModelProperty(value = "区县地区ID")
    private Long area;

    @NotNull(message = "乡镇地区ID不能为空")
    @ApiModelProperty(value = "乡镇地区ID")
    private Long town;

    @NotBlank(message = "sku校验信息不能为空")
    @ApiModelProperty(value = "sku校验信息，请把参数转为json字符串")
    @JsonValid(target = CheckSkuSaleStateAndStockRequest.SkuCheckParam.class, isArrayJson = true, arrayMaxSize = 50, message = "skuList不是jsonArr类型字段")
    private String skuList;




    @Data
    public static class SkuCheckParam implements Serializable {
        private static final long serialVersionUID = -8498370741983699232L;
        @NotNull(message = "产品Id不能为空")
        @ApiModelProperty(value = "产品Id")
        private Long prodId;
        @NotNull(message = "sku编码不能为空")
        @ApiModelProperty(value = "sku编码")
        private Long skuId;
        @NotNull(message = "sku数量为空")
        @ApiModelProperty(value = "sku数量")
        private Integer skuNum;
        @NotNull(message = "sku单价为空")
        @ApiModelProperty(value = "sku单价")
        private BigDecimal price;

    }


    @Override
    @ApiModelProperty(hidden = true)
    public String getApiPath() {
        return ApiPathConstants.CHECK_PROD_SALE_STATE_AND_STOCK;
    }
}
